export default {
  namespaced: true,
  state: {
    // 页面文档可视高度(随窗口改变大小)
    documentClientHeight: 0,
    // 导航条, 布局风格, defalut(默认) / inverse(反向)
    navbarLayoutType: 'default',
    // 侧边栏, 布局皮肤, light(浅色) / dark(黑色)
    sidebarLayoutSkin: 'dark',
    // 侧边栏, 折叠状态
    sidebarFold: false,
    // 侧边栏, 菜单
    menuList: [],
    menuActiveName: '',
    // 内容, 是否需要刷新
    contentIsNeedRefresh: false,
    // 主入口标签页
    mainTabs: [],
    mainTabsActiveName: '',
    isAddDynamicMenuRoutes: false
  },
  getters: {
    getMainTabs: (state: any) => {
      return state.mainTabs
    }
  },
  mutations: {
    updateDocumentClientHeight (state: any, height: Number) {
      state.documentClientHeight = height
    },
    updateSidebarFold (state: any, fold: boolean) {
      state.sidebarFold = fold
    },
    updateMainTabs (state: any, tabs: any) {
      state.mainTabs = tabs
    },
    updateMenuActiveName (state: any, name: string) {
      state.menuActiveName = name
    },
    updateMainTabsActiveName (state: any, name: string) {
      state.mainTabsActiveName = name
    },
    updateMenuList (state: any, list: any) {
      state.menuList = list
    },
    updateAddMenuRouters (state: any, status: boolean) {
      state.isAddDynamicMenuRoutes = status
    }
  },
  actions: {
    clearMenuState (context: any) {
      context.commit('updateMenuActiveName', '')
      context.commit('updateMainTabsActiveName', '')
      context.commit('updateMenuList', [])
      context.commit('updateAddMenuRouters', '')
    }
  }
}